<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>定位</title>
    <style>
        * {
            padding: 0;
            margin: 0;
        }

        body {
            background-image: url(../img/beijing.jpg);
            background-size: cover;
            background-repeat: repeat;
        }

        .box {
            width: 150px;
            height: 150px;
            border: 4px solid rgb(215, 50, 108);
            position: relative;
        }

        .reave {
            position: relative;
            top: 60px;
            left: 20px;
        }

        .absve {
            position: absolute;
            top: 50px;
            left: 4px;
        }

        .stc {
            position: fixed;
            left: 45px;
            top: 370px;
        }

    </style>
</head>

<body>
    <div class="box">
        <div class="reave">绝对定位</div>
    </div>
    <div class="box">
        <div class="reave">绝对定位
            <div class="absve">相对定位</div>
        </div>
    </div>
    <div class="box">
        <div class="stc">固定定位</div>
    </div>
</body>

</html>